<script setup lang="ts">
import { ref } from "vue";
import MainMenu from "@/components/main-menu/MainMenu.vue";
import MainHeader from "@/components/main-header/MainHeader.vue";

const collapse = ref(false);

const handleFoldChange = (isFold: boolean) => {
  collapse.value = isFold;
};
</script>

<template>
  <div class="main-wrapper">
    <el-container>
      <el-aside :width="collapse ? '60px' : '240px'">
        <MainMenu :collapse="collapse" />
      </el-aside>
      <el-container>
        <el-header height="50px">
          <MainHeader @update:isFold="handleFoldChange" />
        </el-header>
        <el-main>
          <RouterView />
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<style scoped lang="less">
.main-wrapper {
  height: 100%;
  background: #eee;

  .el-container {
    height: 100%;
  }

  //滚动条等样式设置
  .el-aside {
    overflow-x: hidden;
    overflow-y: auto;
    text-align: left;
    cursor: pointer;
    transition: width 0.3s linear;
    scrollbar-width: none;
    -ms-overflow-style: none;
    border-radius: 16px;
    margin: 5px;

    &::-webkit-scrollbar {
      display: none;
    }
  }
  .el-container {
    margin-right: 5px;
  }

  .el-header {
    background-color: #ffffff;
    box-shadow: 0 0 5px #f5f5f5;
    border-bottom: 1px solid #f8f8f8;
    border-radius: 16px;
    margin: 5px 20px 5px 20px;
  }

  .el-main {
    background-color: #eeeeee;
  }
}
</style>
